import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.*;

/**
 * 
 * @author Pietro Bua & Rohmin Mirza
 *http://danielwestheide.com/blog/2013/02/27/the-neophytes-guide-to-scala-part-14-the-actor-approach-to-concurrency.html
 */
public class Apl
{
	private static int NR_OF_DEVELOPERS = 7;
	private static int NR_OF_CUSTOMERS = 5;
	private static ActorRef[] developers, customers;
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		ActorSystem office = ActorSystem.create("Office");
		final int LONGENOUGH = 10000;
	    ActorRef leader = office.actorOf(Props.create(Leader.class),"Leader"); // Klaas
		ActorRef secretary = office.actorOf(Secretary.prop(leader), "Secretary");


		developers = new ActorRef[NR_OF_DEVELOPERS]; 
	    for(int i = 0; i < NR_OF_DEVELOPERS;i++)
		{
			developers[i] = office.actorOf(Developer.prop(secretary),"Developer_"+(i+1));
		}

		customers =  new ActorRef[NR_OF_CUSTOMERS];
	    for(int i = 0; i < NR_OF_CUSTOMERS;i++)
		{
			customers[i] = office.actorOf(Customer.prop(secretary),"Customer_" + (i+1));
		}
	    try	
	    {	
			Thread.sleep(LONGENOUGH);	
	 	}	
	    catch(InterruptedException e)	
	    {	
	 	}	

				
		office.shutdown();
	}

}
